package com.belizer.demo.thread;


/**
 * final的使用
 */
public class Demo8 {

    public static void main(String[] args) {
        UnsafeStates unsafeStates = new UnsafeStates();
        // final变量只允许赋值一次
        final String[] states;
//        states[2] = "TK";

        states = new String[]{};

    }

    public static  class UnsafeStates {
        // 添加final后，只允许赋值一次
        private final String[] states = new String[]{
                "AK","AL"
        };

        public String[] getStates(){
            return states;
        }


    }
}
